package com.ai.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.ConsultService;
import com.ai.web.vo.ConsultV;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.Consult;
import com.tiny.persistence.repository.ConsultRepo;

@Service
public class ConsultServiceImpl extends BaseServiceImpl<Consult, Integer, ConsultV> implements ConsultService  {

    @Autowired
    private ConsultRepo consultRepo;
    
    @Autowired
    public ConsultServiceImpl(ConsultRepo consultRepo) {
        super(consultRepo);
    }

    public ConsultV getConsult(int userId) throws Exception {
        return getT(userId);
    }

    public ResultModel saveConsult(ConsultV consultV) throws Exception {
        
        ConsultV saveV = saveT(consultV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

    public ResultModel deleteConsults(List<Integer> userIds) throws Exception {
        deleteTs(userIds);
        
        ResultModel rm = new ResultModel();
        rm.setSuccessCode();
        rm.setMsg("删除成功！");
        
        return rm;
    }

}
